﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace TotalFreedomAngularJS
{
    public static partial class AjAttributeHelpers
    {
        #region form fields

        public static IAjAttributeHtmlString<TModel> AjModel<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression)
        {
            if (htmlHelper == null)
                return null;

            PropertyData data = AjHelperExtensions.GetPropertyData(expression, true);
            string s = data.PropertyName;
            return new AjAttributeHtmlString<TModel, TProperty>(null, "ng-model", s, htmlHelper.ViewData);
        }

        public static IAjAttributeHtmlString<TModel> AjRepeat<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, Expression<Func<object>> expr2)
        {
            if (htmlHelper == null)
                return null;

            PropertyData data = AjHelperExtensions.GetPropertyData(expression, true);
            string s = data.PropertyName;
            return new AjAttributeHtmlString<TModel, TProperty>(null, "ng-repeat", s, htmlHelper.ViewData);
        }

        public static IAjAttributeHtmlString<TModel> AjSubmit<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression)
        {
            if (htmlHelper == null)
                return null;

            PropertyData data = AjHelperExtensions.GetPropertyData(expression, true);
            string s = data.PropertyName;
            return new AjAttributeHtmlString<TModel, TProperty>(null, "ng-submit", s, htmlHelper.ViewData);
        }

        public static IAjAttributeHtmlString<TModel> AjClick<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression)
        {
            if (htmlHelper == null)
                return null;

            PropertyData data = AjHelperExtensions.GetPropertyData(expression, true);
            string s = data.PropertyName;
            return new AjAttributeHtmlString<TModel, TProperty>(null, "ng-click", s, htmlHelper.ViewData);
        }

        public static IAjAttributeHtmlString<TModel> AjController<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression)
        {
            if (htmlHelper == null)
                return null;

            PropertyData data = AjHelperExtensions.GetPropertyData(expression, true);
            string s = data.PropertyName;
            return new AjAttributeHtmlString<TModel, TProperty>(null, "ng-controller", s, htmlHelper.ViewData);
        }

        public static object AjCreateController<TModel, TController>(this HtmlHelper<TModel> htmlHelper)
        {
            if (htmlHelper == null)
                return null;

            return null;
        }         

        #endregion
    }
}
